#+TITLE: FFMPEG Cheatsheet
* Convert mp4 to ogg

ffmpeg -i input.mp4 -acodec libvorbis -vcodec libtheora -f ogv output.ogv

converting all mp4's in a directory to ogg

systemctl | grep -m 1 ifplugd | awk '{print $1}' | xargs systemctl status {}

#+BEGIN_SRC sh :results output :dir ~/videos
for file in *.mp4
do
  echo "$file" "${file/.mp4/.ogg}"
  ffmpeg -i "$file" -acodec libvorbis -vcodec libtheora -f ogv "${file/.mp4/.ogg}"
done
#+END_SRC

#+RESULTS:
* concat all audio files to one big file

#+BEGIN_SRC shell :dir ~/audio/TheWiseMansFear :results raw
 ls
#+END_SRC

#+RESULTS:
Patrick Rothfuss - The Wise Man's Fear.nfo
PRWMXX-36 Patrick Rothfuss - The Wise Man's Fear.sfv
PRWMXX-36 Patrick Rothfuss - The Wise Man's Fear.sv
The Wise Man's Fear 01-36.mp3
The Wise Man's Fear 02-36.mp3
The Wise Man's Fear 03-36.mp3
The Wise Man's Fear 04-36.mp3
The Wise Man's Fear 05-36.mp3
The Wise Man's Fear 06-36.mp3
The Wise Man's Fear 07-36.mp3
The Wise Man's Fear 08-36.mp3
The Wise Man's Fear 09-36.mp3
The Wise Man's Fear 10-36.mp3
The Wise Man's Fear 11-36.mp3
The Wise Man's Fear 12-36.mp3
The Wise Man's Fear 13-36.mp3
The Wise Man's Fear 14-36.mp3
The Wise Man's Fear 15-36.mp3
The Wise Man's Fear 16-36.mp3
The Wise Man's Fear 17-36.mp3
The Wise Man's Fear 18-36.mp3
The Wise Man's Fear 19-36.mp3
The Wise Man's Fear 20-36.mp3
The Wise Man's Fear 21-36.mp3
The Wise Man's Fear 22-36.mp3
The Wise Man's Fear 23-36.mp3
The Wise Man's Fear 24-36.mp3
The Wise Man's Fear 25-36.mp3
The Wise Man's Fear 26-36.mp3
The Wise Man's Fear 27-36.mp3
The Wise Man's Fear 28-36.mp3
The Wise Man's Fear 29-36.mp3
The Wise Man's Fear 30-36.mp3
The Wise Man's Fear 31-36.mp3
The Wise Man's Fear 32-36.mp3
The Wise Man's Fear 33-36.mp3
The Wise Man's Fear 34-36.mp3
The Wise Man's Fear 35-36.mp3
The Wise Man's Fear 36-36.mp3
Torrent downloaded from Demonoid.me.txt

** create a mylist.txt file

#+BEGIN_SRC shell :dir ~/audio/TheWiseMansFear :results raw
 printf "file '%s'\n" *.mp3 > mylist.txt
#+END_SRC

#+RESULTS:

#+BEGIN_SRC shell :dir ~/audio/TheWiseMansFear :results raw
 cat mylist.txt
#+END_SRC

#+RESULTS:
file 'TheWiseMansFear01-36.mp3'
file 'TheWiseMansFear02-36.mp3'
file 'TheWiseMansFear03-36.mp3'
file 'TheWiseMansFear04-36.mp3'
file 'TheWiseMansFear05-36.mp3'
file 'TheWiseMansFear06-36.mp3'
file 'TheWiseMansFear07-36.mp3'
file 'TheWiseMansFear08-36.mp3'
file 'TheWiseMansFear09-36.mp3'
file 'TheWiseMansFear10-36.mp3'
file 'TheWiseMansFear11-36.mp3'
file 'TheWiseMansFear12-36.mp3'
file 'TheWiseMansFear13-36.mp3'
file 'TheWiseMansFear14-36.mp3'
file 'TheWiseMansFear15-36.mp3'
file 'TheWiseMansFear16-36.mp3'
file 'TheWiseMansFear17-36.mp3'
file 'TheWiseMansFear18-36.mp3'
file 'TheWiseMansFear19-36.mp3'
file 'TheWiseMansFear20-36.mp3'
file 'TheWiseMansFear21-36.mp3'
file 'TheWiseMansFear22-36.mp3'
file 'TheWiseMansFear23-36.mp3'
file 'TheWiseMansFear24-36.mp3'
file 'TheWiseMansFear25-36.mp3'
file 'TheWiseMansFear26-36.mp3'
file 'TheWiseMansFear27-36.mp3'
file 'TheWiseMansFear28-36.mp3'
file 'TheWiseMansFear29-36.mp3'
file 'TheWiseMansFear30-36.mp3'
file 'TheWiseMansFear31-36.mp3'
file 'TheWiseMansFear32-36.mp3'
file 'TheWiseMansFear33-36.mp3'
file 'TheWiseMansFear34-36.mp3'
file 'TheWiseMansFear35-36.mp3'
file 'TheWiseMansFear36-36.mp3'

** Create the one big file.
#+BEGIN_SRC shell :dir ~/audio/TheWiseMansFear :results raw
ffmpeg -f concat -i mylist.txt -c copy TheWiseMansFear.mp3
#+END_SRC

#+RESULTS:
** possibly rename all files in directory to exclude spaces

wdired-change-to-dired-wdired-mode will help with that.  Save the buffer with
C-x C-s.
* convert 1080p video to 720p

ffmpeg -i movie.1080p.mp4  -vf scale=1280:720  movie.720p.mp4
